<!DOCTYPE html>
<html class="x-admin-sm">
<head>
<meta charset="UTF-8">
<title>小程序列表</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="__ADMIN__/css/font.css">
<link rel="stylesheet" href="__ADMIN__/css/xadmin.css">
<script type="text/javascript" src="__ADMIN__/js/jquery.min.js"></script>
<script type="text/javascript" src="__ADMIN__/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="__ADMIN__/js/xadmin.js"></script>
<script type="text/javascript" src="__ADMIN__/js/cookie.js"></script>
<style>
.layui-btn+.layui-btn{
margin-left: 0;
}
</style>
</head>
<body>
    <div class="x-body x-admin">
      <xblock>
        <button class="layui-btn" onclick="x_admin_show('新增','{:url('Wxapp/edit')}','','550','600')" >新增</button>
      </xblock>
      <div class="layui-card-body" style="padding-left: 0;float:left;padding-left:20px;padding-top:0;">
        <form class="layui-form layui-col-space5" action="" method="get">
            <div class="layui-inline layui-show-xs-block">
              <input style="width:260px;" type="text" name="keyword" id="keyword" value="" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
            {if condition="$list[0]['type'] eq '徐总'"}
            <div class="layui-inline layui-show-xs-block">
              <select name="status_text" id="status_text">
                <option value="">全部</option>
                <option value="入口" {:input('status_text')=='入口'?'selected':''}>入口</option>
                <option value="投票专属" {:input('status_text')=='投票专属'?'selected':''}>投票专属</option>
                <option value="报名专属" {:input('status_text')=='报名专属'?'selected':''}>报名专属(单封/警告)</option>
                <option value="专题专属" {:input('status_text')=='专题专属'?'selected':''}>专题专属</option>
                <option value="其他" {:input('status_text')=='其他'?'selected':''}>其他(活动专属小程序)</option>
                <option value="已双封" {:input('status_text')=='已双封'?'selected':''}>已双封</option>
                <option value="永久封" {:input('status_text')=='永久封'?'selected':''}>永久封</option>
                <option value="已注销" {:input('status_text')=='已注销'?'selected':''}>已注销</option>
                <option value="封主体" {:input('status_text')=='封主体'?'selected':''}>封主体</option>
              </select>
            </div>
            <div class="layui-inline layui-show-xs-block">
              <select name="address" id="address">
                <option value="">全部</option>
                <option value="可赞" {:input('address')=='可赞'?'selected':''} >可赞</option>
                <option value="万达B" {:input('address')=='B座'?'selected':''} >万达B</option>
                <option value="东创" {:input('address')=='东创'?'selected':''} >东创</option>
                <option value="星权" {:input('address')=='星权'?'selected':''} >星权</option>
              </select>
            </div>
            <div class="layui-inline layui-show-xs-block">
              <select name="status" id="status">
                <option value="">全部</option>
                <option value="1" {:input('status')=='1'?'selected':''} >正常</option>
                <option value="2" {:input('status')=='2'?'selected':''} >警告</option>
                <option value="0" {:input('status')=='0'?'selected':''} >停用</option>
              </select>
            </div>
            {/if}
            <div class="layui-inline layui-show-xs-block">
              <button class="layui-btn" id="search-btn">搜索</button>
            </div>
            
            <div class="layui-inline layui-show-xs-block">绑定开启活动数{$voteCount}</div>
        </form>
      </div>
      
      <div class="layui-table-body layui-table-main" style="width: 100%;">
      <table class="layui-table layui-form">
        <thead>
          <tr> 
            <th>小程序名</th>
            <th>预计双封时间</th>
            <th>分组</th>
            <th>绑定注册人</th>
            <th>绑定开发者</th>
            <th>地区</th>
            <th>公众号</th>
            <th style="width: 10%;text-align: center;">警告标记</th>
            <th style="width: 10%;text-align: center;">显示状态</th>
            <th style="text-align: center;">操作</th>
        </thead>
        <tbody>
          {volist name="list" id="value"}
          <tr {if condition="$value.red eq 1"}style="background:#f9ffa5"{/if}> 
            <td>{$value.name}-{$value.id}</td>
            <td>{$value.last_time?date('Y-m-d H:i',$value.last_time):''}</td>
            <td>{$value.status_text}</td>
            <td>{$value.admin_name}</td>
            <td>{$value.developer}</td>
            <td>{$value.address}</td>
            <td>{$value.official_account}</td>
            <td class="td-status" style="width: 10%;text-align: center;">
                <input type="checkbox" name="red" lay-skin="switch"  lay-text="标记|正常" {if condition="$value['red'] eq 1"}checked{/if} lay-filter="red" id="{$value.id}" value="{$value.red}">
            </td>
            <td class="td-status" style="width: 10%;text-align: center;">
                <input type="checkbox" name="status" lay-skin="switch"  lay-text="显示|隐藏" {if condition="$value['status'] eq 1"}checked{/if} lay-filter="status" id="{$value.id}" value="{$value.status}">
            </td>
            <td class="td-manage" style="text-align: center;">
              <a title="活动列表" class="layui-btn layui-btn-normal layui-btn-xs" onclick="x_admin_show('{$value.name}下的活动','{:url('Wxapp/liveList',['id'=>$value.id])}','','860','600')"  href="javascript:;">
                活动列表
              </a>
              
              <a title="编辑" class="layui-btn layui-btn-normal layui-btn-xs" onclick="x_admin_show('编辑','{:url('Wxapp/edit',['id'=>$value.id])}','','550','600')" href="javascript:;">
                编辑
              </a>
            </td>
          </tr>
          {/volist}
        </tbody>
      </table>
      </div>
      
    </div>


<script>
layui.use(['form'], function(){
    form = layui.form;
    form.on('switch(status)', function(data){
      var obj=data.elem;
      var id = data.elem.id;
      var status = data.value;
      $.ajax({
          type:'POST',
          dataType:'json',
          data:{status:status,field:'status',id:id},
          url:"{:url('Wxapp/changeStatus')}",
          success:function(o){
            if(o.icon == 1){
              $(obj).attr('value',1);
            }else{
              $(obj).attr('value',0);
            }
            layer.msg(o.msg,{icon: o.icon,time:1000});
            location.reload();
          }
        });
    });
    form.on('switch(red)', function(data){
      var obj=data.elem;
      var id = data.elem.id;
      var status = data.value;
      $.ajax({
          type:'POST',
          dataType:'json',
          data:{status:status,field:'red',id:id},
          url:"{:url('Wxapp/changeStatus')}",
          success:function(o){
            if(o.icon == 1){
              $(obj).attr('value',1);
            }else{
              $(obj).attr('value',0);
            }
            layer.msg(o.msg,{icon: o.icon,time:1000});
            location.reload();
          }
        });
    });
    
});

</script>
{if condition="$isSuper eq 1 "}
{/if}
</body>

</html>